package com.azj.springboothelloword;

import cn.hutool.core.util.StrUtil;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.*;

//相当于@Controller+@ResponseBody两个注解的结合 不能返回给前端
@RestController
@SpringBootApplication
public class SpringbootHellowordApplication {

    public static void main(String[] args) {
        SpringApplication.run(SpringbootHellowordApplication.class, args);
    }


//    @RequestMapping(value = "/hello",method = RequestMethod.GET)

    @GetMapping("/hello")   //@GetMapping用于处理请求方法的GET类型，@ PostMapping用于处理请求方法的POST类型等。
    public String sayHello(@RequestParam(required = false,name = "who") String who){    //@RequestParam接收的参数是来自HTTP请求体或请求url的QueryString中。
        if (StrUtil.isBlank(who)){
            who = "World";
        }
        return StrUtil.format("Hello,{}",who);
    }



}
